/**
 * 所有组件优化的全部放这里面
 * 这里是为了组件优化提高浏览器性能特意抽离出来的组件
 * 包含公共组件、业务组件
 * branchName: f-chat-qixiaofei
 * time: 2020/06/16
 * */

/**
  * 业务组件
  * */
const component = Object.create(null)
component.install = function (vue) {


  //  首页用到业务的组件
  const rightPopover = r => require.ensure([], () => r(require('@/components/home/rigitPopover')), 'rightPopover') // 右侧菜单导航栏
  const footerMenu = r => require.ensure([], () => r(require('@/components/home/footerMenu')), 'footerMenu') //  底部菜单导航栏
  const homeHeader = r => require.ensure([], () => r(require('@/components/home/header')), 'homeHeader') //  头部
  const search = r => require.ensure([], () => r(require('@/components/home/search')), 'search') //  搜索
  const nav = r => require.ensure([], () => r(require('@/components/home/nav')), 'nav') //  导航

  // 招聘会
  const setCompanyLabel = r => require.ensure([], () => r(require('@/components/page/jobfair/components/setCompanylabel')), 'setCompanyLabel') //  设置公司标签组件
  const jobSelection = r => require.ensure([], () => r(require('@/components/page/jobfair/components/jobSelection')), 'jobSelection') //   设置 选择职位组件

  // 聊天
  const contacts = r => require.ensure([], () => r(require('@/components/page/chat/chatComponent/contacts')), 'contacts') // 聊天 左侧联系人列表
  const resumeIntroduction = r => require.ensure([], () => r(require('@/components/page/chat/chatComponent/contactsRight')), 'resumeIntroduction') // 聊天 左侧联系人列表
  const chatWindow = r => require.ensure([], () => r(require('@/components/page/chat/chatComponent/chatWindow')), 'chatWindow') //  聊天 右侧聊天区

  // 注册全局组件
  vue.component('rightPopover', rightPopover) // 右侧菜单导航栏
  vue.component('footerMenu', footerMenu) // 底部菜单导航栏
  vue.component('homeHeader', homeHeader) // 头部
  vue.component('search', search) // 搜索
  vue.component('homeNav', nav)
  vue.component('setCompanyLabel', setCompanyLabel)
  vue.component('jobSelection', jobSelection)
  vue.component('contactList', contacts)
  vue.component('resumeIntroduction', resumeIntroduction)
  vue.component('chatRegion', chatWindow)
}

// 导出组件
export default component